home *** CD-ROM | disk | FTP | other *** search
/ L' Effet Pommier 3 / L'Effet Pommier - Volume 03.iso / Education et Sciences / Mathématiques / Matt's_Fract 1.05 / Sources / includes / VideoVars.c < prev   
C/C++ Source or Header  |  1995-08-13  |  3KB  |  164 lines

  1. #include "AllTools.h"
  2.  
  3. videoInfo GetVideoInfo(void)
  4. {
  5. videoInfo    theScreen;
  6. short        count;
  7.  
  8. theScreen.isVideo = TRUE;
  9. theScreen.screenBase = GetScrnBase();
  10. theScreen.resolutionX = GetScrnWidth();
  11. theScreen.resolutionY = GetScrnHeight();
  12. theScreen.rowBytes = GetScrnRowBytes();
  13. theScreen.bitsPerPixel = GetScrnDepth();
  14. theScreen.screenRect = GetScreenRect();
  15.  
  16. for (count = 0; count < 64; count ++)
  17. {
  18.     theScreen.BitDepthPossible[count] = gotDepth(count);
  19. }
  20.  
  21. return theScreen;
  22. }
  23.  
  24. Ptr                GetScrnBase(void)
  25. {
  26. GDHandle        theGDHandle;
  27. GDevice            theGDDevice;
  28. PixMapHandle    thePixMapHandle;
  29. PixMap            thePixMap;
  30. Ptr                ScrnBase;
  31.  
  32. theGDHandle  = GetTheGDevice();
  33. theGDDevice  = **(theGDHandle);
  34. thePixMapHandle = theGDDevice.gdPMap;
  35. thePixMap = **(thePixMapHandle);
  36. ScrnBase = thePixMap.baseAddr;
  37.  
  38. return ScrnBase;
  39. }
  40.  
  41. short             GetScrnWidth(void)
  42. {
  43. GDHandle        theGDHandle;
  44. GDevice            theGDDevice;
  45. PixMapHandle    thePixMapHandle;
  46. PixMap            thePixMap;    
  47. Rect            theScreenRect;
  48. short            theWidth;
  49.  
  50. theGDHandle  = GetTheGDevice();
  51. theGDDevice  = **(theGDHandle);
  52. thePixMapHandle = theGDDevice.gdPMap;
  53. thePixMap = **(thePixMapHandle);
  54. theScreenRect = thePixMap.bounds;
  55. theWidth = theScreenRect.right - theScreenRect.left;
  56.  
  57. return theWidth;
  58. }
  59.  
  60. short            GetScrnHeight(void)
  61. {
  62. GDHandle        theGDHandle;
  63. GDevice            theGDDevice;
  64. PixMapHandle    thePixMapHandle;
  65. PixMap            thePixMap;    
  66. Rect            theScreenRect;
  67. short            theHeight;
  68.  
  69. theGDHandle  = GetTheGDevice();
  70. theGDDevice  = **(theGDHandle);
  71. thePixMapHandle = theGDDevice.gdPMap;
  72. thePixMap = **(thePixMapHandle);
  73. theScreenRect = thePixMap.bounds;
  74. theHeight = theScreenRect.bottom - theScreenRect.top;
  75.  
  76. return theHeight;
  77. }
  78.  
  79. short             GetScrnDepth(void)
  80. {
  81. GDHandle        theGDHandle;
  82. GDevice            theGDDevice;
  83. PixMapHandle    thePixMapHandle;
  84. PixMap            thePixMap;
  85. short            theDepth;
  86.  
  87. theGDHandle  = GetTheGDevice();
  88. theGDDevice  = **(theGDHandle);
  89. thePixMapHandle = theGDDevice.gdPMap;
  90. thePixMap = **(thePixMapHandle);
  91. theDepth = thePixMap.pixelSize;
  92.  
  93. return theDepth;
  94. }
  95.  
  96. Boolean gotDepth(short count)
  97. {
  98. GDHandle        theGDHandle;
  99. short            theMode;
  100.  
  101. theGDHandle  = GetTheGDevice();
  102.  
  103. theMode = HasDepth(theGDHandle, count, 1, 1);
  104.  
  105. return (theMode > 0);
  106. }
  107.  
  108. short             GetScrnRowBytes(void)
  109. {
  110. GDHandle        theGDHandle;
  111. GDevice            theGDDevice;
  112. PixMapHandle    thePixMapHandle;
  113. PixMap            thePixMap;
  114. short            rowBytes;
  115.  
  116. theGDHandle  = GetTheGDevice();
  117. theGDDevice  = **(theGDHandle);
  118. thePixMapHandle = theGDDevice.gdPMap;
  119. thePixMap = **(thePixMapHandle);
  120. rowBytes = (short)thePixMap.rowBytes;
  121. rowBytes = (short)((unsigned long)rowBytes & 4093);
  122.  
  123. return rowBytes;
  124. }
  125.  
  126. unsigned char    GetVolume(void)
  127. {
  128. return LMGetSdVolume();
  129. }
  130.  
  131. void             SetVolume(unsigned char SdVolumeValue)
  132. {
  133. LMSetSdVolume(SdVolumeValue);
  134. }
  135.  
  136. StringPtr         GetFinderName(void)
  137. {
  138. return LMGetFinderName();
  139. }
  140.  
  141. void             SetFinderName(StringPtr FinderNameValue)
  142. {
  143. LMSetFinderName(FinderNameValue);
  144. }
  145.  
  146. Ptr                GetTheA5(void)
  147. {
  148. return LMGetCurrentA5();
  149. }
  150.  
  151. void             SetTheA5(Ptr CurrentA5Value)
  152. {
  153. LMSetCurrentA5(CurrentA5Value);
  154. }
  155.  
  156. GDHandle GetTheGDevice(void)
  157. {
  158. return LMGetTheGDevice();
  159. }
  160.  
  161. Rect            GetScreenRect(void)
  162. {
  163.     return qd.screenBits.bounds;
  164. }